package net.wofly.sale.stock.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.wofly.sale.stock.repository.ResourceAskListRepository;
import net.wofly.sale.stock.domain.ResourceAskList;
import net.wofly.sale.stock.service.IResourceAskListService;

@Service("iResourceAskListService")
@Transactional
public class ResourceAskListServiceImpl implements IResourceAskListService {

	@Autowired
	ResourceAskListRepository resourceAskListRepository;

	@Override
	public ResourceAskList save(ResourceAskList entity) {
		return resourceAskListRepository.save(entity);
	}

	@Override
	public void delete(ResourceAskList entity) {
		resourceAskListRepository.delete(entity);
	}

	@Override
	public void delete(String key) {
		resourceAskListRepository.delete(key);
	}

	@Override
	public ResourceAskList findOne(String key) {
		return resourceAskListRepository.findOne(key);
	}

	@Override
	public List<ResourceAskList> save(List<ResourceAskList> entityList) {
		return (List<ResourceAskList>) resourceAskListRepository.save(entityList);
	}

	@Override
	public void deleteByResourceAskID(String resourceAskID) {
		resourceAskListRepository.deleteByResourceAskID(resourceAskID);
	}

	@Override
	public List<ResourceAskList> findByResourceAskID(String resourceAskID) {
		return resourceAskListRepository.findByResourceAskID(resourceAskID) ;
	}

	@Override
	public ResourceAskList findByResourceAskIDAndCommodityTerminalID(String resourceAskID, String commodityTerminalID) {
		return resourceAskListRepository.findByResourceAskIDAndCommodityTerminalID(resourceAskID, commodityTerminalID);
	}
}
